<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style type="text/css">
 table,table tr th, table tr td { border:1px solid #0094ff;margin:20px auto; float: center;}
th {
	width: 40px;
	height: 20px;
}

.header {
border:2px solid black;
	border-radius: 15px;
	width: 45%;
	height: 300px;
	margin: 50px auto;
	text-align: center;
	padding:50px;
}

body {
background-size:100%;

}
</style>
</head>
<body style="background-image: url('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=979493433,3014941077&amp;fm=27&amp;gp=0.jpg'); background-repeat: no-repeat;">
<h1 style="text-align:center;">从数据库查到的数据为：</h1>
	<div>
	<button onclick="printpage()">打印</button>
	
	<script type="text/javascript">
	function printpage() {
	    window.print();
	}

	/**
	 * 打印局部div
	 * @param printpage 局部div的ID
	 */
	function printdiv(printpage) {
	    var headhtml = "<html><head><title></title></head><body>";
	    var foothtml = "</body>";
	    // 获取div中的html内容
	    var newhtml = document.all.item(printpage).innerHTML;
	    // 获取div中的html内容，jquery写法如下

	    // 获取原来的窗口界面body的html内容，并保存起来
	    var oldhtml = document.body.innerHTML;

	    // 给窗口界面重新赋值，赋自己拼接起来的html内容
	    document.body.innerHTML = headhtml + newhtml + foothtml;
	    // 调用window.print方法打印新窗口
	    window.print();

	    // 将原来窗口body的html值回填展示
	    document.body.innerHTML = oldhtml;
	    return false;
	}
	</script>

	
	
	
	
	</div>
	<div class="header" >
		

		<form action="YouKeXinxi">
			<table>
				<tr>
					<th>UserName</th>
					<th>UserPassword</th>
					<th>LoginName</th>
					<th>Sex</th>
					<th>YouXiang</th>
					<th>QQ</th>

				</tr>
				<c:forEach items="${list2}" var="k">
					<tr>
						<td>${k.UserName }</td>
						<td>${k.UserPassword }</td>
						<td>${k.LoginName }</td>

						<td><c:if test="${k.Sex ==1}">女</c:if> <c:if
								test="${k.Sex ==2}">男</c:if></td>

						<td>${k.YouXiang}</td>
						<td>${k.QQ}</td>

					</tr>
					<c:forEach items=""></c:forEach>
				</c:forEach>

			</table>

		</form>
	</div>
</body>
</html>